<h1 class="cat_title">Result</h1>
<hr />
<?php 
if(!empty($posts)):
?>

<?php 
$i=0;

foreach($posts as $post): 
if($i>0 && $i%4==0)
    $last = 'last';
else
    $last='';
    $product_name = $this->_global->_unserialize($post->product_name);
    $alias = $this->_global->_unserialize($post->product_alias);
    if(isset($alias[$this->session->userdata('lan')]['alias']))
        $alias = $alias[$this->session->userdata('lan')]['alias'];
    else
        $alias = '';
    
    if(isset($product_name[$this->session->userdata('lan')]['product_name']))
        $product_name = $product_name[$this->session->userdata('lan')]['product_name'];
    else
        $product_name = '';
    $detail = $this->_global->_unserialize($post->product_detail);
    $color = current($detail['options']['colors']);
    
?>
    <div class="item  <?php echo $last ?>" style="position: relative;">
        <div align="center" class="product">
        <div class="img"><?php echo anchor('shop/c'.$post->cat_id.'/'.$post->product_id.'-'.$alias,'<img alt="'.$product_name.'" src="'.$this->config->item('cdn_url').'exec/timthumb.php?src='.base_url().current($color['images']).'&h=210&w=170"/>','title="'.$product_name.'"') ?></div>
        <p class="title"><?php echo anchor('shop/c'.$post->cat_id.'/'.$post->product_id.'-'.$alias,$product_name); ?></p>
        <div><span class="price" style="position: absolute;bottom: 5px;left: 10px;"><span><?php echo $post->price_export ?> vnd</span></span></div>
        <p class="clear"></p>
        </div>
</div>

<?php 

endforeach; ?>

<?php
else:
?>
<div><h1 class="title"><?php echo $this->lang->line('notfound') ?></h1></div>
<?php
endif;
unset($posts);
?>